<?php
class  ApiCenter_ProductApi_Model_Api2_Product_Attribute  extends  Mage_Api2_Model_Resource {
    
    
    const  STOREID =1;
    
    protected function _loadSetAttribute($setId){
         
        $collection = Mage::getResourceModel('catalog/product_attribute_collection')
        ->setAttributeSetFilter($setId)
        ->addVisibleFilter()
        ->load();
    
        return $collection->getData();
         
    }
    
    /**
     * 检查属性集是否存在
     *
     * @param  $attributeSetId
     * @throw Mage_Api_Exception
     * @return void
     */
    protected function _checkProductAttributeSet($attributeSetId)
    {
        $attributeSet = Mage::getModel('eav/entity_attribute_set')->load($attributeSetId);
        if (is_null($attributeSet->getId())) {
            $this->_critical('product_attribute_set_not_exists');
        }
        if (Mage::getModel('catalog/product')->getResource()->getTypeId() != $attributeSet->getEntityTypeId()) {
            $this->_critical('product_attribute_set_not_valid');
        }
    }
     
}